package com.pe1n.yangtaopai.helper;

import com.pe1n.yangtaopai.retrofitApi.RetrofitApi;
import com.pe1n.yangtaopai.utils.URLConstant;

import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by My on 2016/11/21.
 */

public class InitRetrofitHelper {
    private static RetrofitApi retrofitInterface;
    public static RetrofitApi getRetrofitInterfance() {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(URLConstant.BASE_URL)
                .client(new OkHttpClient())
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .build();
        retrofitInterface = retrofit.create(RetrofitApi.class);

        return  retrofitInterface;
    }

}
